//var blackServerAdr="http://192.168.0.106:8080/";//本地
angular.module('starter.blackService', [])
//网友主页面Service
.factory('networkCollectRecordService',function($http,$q){
	return {
		getNetworkCollectRecordList : function(userId,token,page,num,condition,province,city,district){
			var deferred = $q.defer();
		$http({
			method:'post',
			url:blackServerAdr+"app/networkCollectRecords.htm",
			params:{"userId":userId ,"token":token,"page":page,"num":num,"condition":condition,"province":province,"city":city,"district":district}
		}).success(function (response) {
			  	deferred.resolve(response);
		}).error(function(data) {
		        deferred.reject();
		});
		return deferred.promise;
		}
	}
})
//网友曝光详情页面Service
.factory('networkCollectRecordDetailService',function($http,$q){
	return {
		getNetworkCollectRecordDetail : function(userId,networkCollectRecordId){
			var deferred = $q.defer();
			$http({
				method:'post',
				url:blackServerAdr+"app/networkCollectRecordDetail.htm",
				params:{"userId":userId,"networkCollectRecordId":networkCollectRecordId}
			}).success(function(response) {
				deferred.resolve(response);
			}).error(function(data){
				deferred.reject();
			});
			return deferred.promise;
		},
		getnetworkCollectRecordPic : function(userId,networkCollectRecordId){
			var deferred = $q.defer();
			$http({
				method:'post',
				url:blackServerAdr+"app/networkCollectRecordPic.htm",
				params:{"userId":userId,"networkCollectRecordId":networkCollectRecordId}
			}).success(function(response) {
				deferred.resolve(response);
			}).error(function(data){
				deferred.reject();
			});
			return deferred.promise;
		}
	};
})

//权威发布页面Service
.factory('breakRecordsService',function($http,$q){
	return {
		getBreakRecordsList : function(userId,token, page, num,condition,province,city,district){
			var deferred = $q.defer();
			$http({
				method:'post',
				url:blackServerAdr+"app/breakRecords.htm",
				params:{"userId":userId,"token":token,"page":page, "num":num,"condition":condition,"province":province,"city":city,"district":district}
			}).success(function(response) {
				deferred.resolve(response);
			}).error(function(data){
				deferred.reject();
			});
			return deferred.promise;
		}
	}
})

//权威发布查询页面Service
.factory('breakRecordSelectService',function($http,$q){
	return {
		getBreakRecordsList : function(userId,condition){
			var deferred = $q.defer();
			$http({
				method:'post',
				url:blackServerAdr+"app/breakRecords.htm",
				params:{"userId":userId,"condition":condition}
			}).success(function(response) {
				deferred.resolve(response);
			}).error(function(data){
				deferred.reject();
			});
			return deferred.promise;
		}
	}
})

//权威发布明细页面Service
.factory('breakRecordDetailService',function($http,$q){
	return {
		getBreakRecordDetail : function(userId,breakRecordId){
			var deferred = $q.defer();
			$http({
				method:'post',
				url:blackServerAdr+"app/breakRecordDetail.htm",
				params:{"userId":userId,"breakRecordId":breakRecordId}
			}).success(function(response) {
				deferred.resolve(response);
			}).error(function(data){
				deferred.reject();
			});
			return deferred.promise;
		},
		getBreakRecordDetailPic : function(userId,breakRecordId){
			var deferred = $q.defer();
			$http({
				method:'post',
				url:blackServerAdr+"app/breakRecordDetailPic.htm",
				params:{"userId":userId,"breakRecordId":breakRecordId}
			}).success(function(response) {
				deferred.resolve(response);
			}).error(function(data){
				deferred.reject();
			});
			return deferred.promise;
		}
	}
})

//提交违约人
.factory('networkPublishService',function($http,$q){
	return {
		getNetworkPublish : function(userId,name,phone,certificateNo,sexdata,title,defaultContent,qq,province,city,district,picAddressList ){
			var deferred = $q.defer();
			$http({
				method:'post',
				url:blackServerAdr+"app/NetworkPublish.htm",
				params:{"userId":userId ,"name":name,"phone":phone,"certificateNo":certificateNo,"sexdata":sexdata,"title":title,"defaultContent":defaultContent,"qq":qq,"province":province,"city":city,"district":district,"picAddressList":picAddressList}
			}).success(function(response) {
				deferred.resolve(response);
			}).error(function(data){
				deferred.reject();
			});
			return deferred.promise;
	}
 };
})
//违约申诉
.factory('allegemanaCommitService',function($http,$q){
	return {
		getAllegemanaCommit : function(userId,name,linkPhone,allegeRecord,certificateNoZHAddress,certificateNoFAddress,certificateNoZAddress){
			var deferred = $q.defer();
			$http({
				method:'post',
				url:blackServerAdr+"app/allegemanaCommit.htm",
				params:{"userId":userId,"name":name,"linkPhone":linkPhone,"allegeRecord":allegeRecord,"certificateNoZHAddress":certificateNoZHAddress,"certificateNoZAddress":certificateNoZAddress,"certificateNoFAddress":certificateNoFAddress}
			}).success(function(response) {
				deferred.resolve(response);
			}).error(function(data){
				deferred.reject();
			});
			return deferred.promise;
	}
  };
})
//获取联系人信息
.factory('breakpromiselinkService',function($http,$q){
	return {
		getBreakpromiselink : function(allPone,Pone){
			var deferred = $q.defer();
			$http({
				method:'post',
				url:blackServerAdr+"app/breakpromiselink.htm",
				params:{'allPone':allPone,'Pone':Pone}
			}).success(function(response) {
				deferred.resolve(response);
			}).error(function(data){
				deferred.reject();
			});
			return deferred.promise;
	}
  };
})

;
